<template>
	<view>
		<view class="status_bar"></view>
		
		<view class="zy-ph-50">
			<view class="zy-row-right zy-text-white-lg-bold" @click="later">稍后</view>
			<view class="zy-register-title" > 加好友后可以交换</view>
			<view class="zy-register-title2" > 微信, 需要你也提供</view>
			<view class="zy-register-title2" > 真实微信号</view>
			<view class="zy-row-right">
				<image class="avatar" :src="avater"></image>
			</view>
			<view class="zy-text-whitegrey-lg-bold" style="font-size: 40rpx; margin-top: -30rpx;">我的微信号是</view>
			<input class="zy-register-input zy-mt-50" v-model="weChat" placeholder=" 请输入微信号" />
			<view class="zy-text-whitegrey zy-mt-sm">微信号仅在你同意后跟对方交换</view>
			
			
			<zy-register-bottom @next="next">
				<view></view>
			</zy-register-bottom>
		</view>
	</view>
</template>

<script>
	import RouteUtil from '@/main/common/RouteUtil';
import CacheUtil from '../common/CacheUtil';
	export default {
		data() {
			return {
				weChat:'',
				avater: ''
			};
		},
		onLoad() {
			this.avater = CacheUtil.getUserPic()
		},
		methods:{
			later(){
				RouteUtil.toHome()
			},
			next(){
				if(this.weChat == ''){
					uni.$toast.showToast('请输入微信号')
					return
				}
				let params = {weChat: this.weChat};
				uni.$http.updateUser(params).then(res => {
					uni.$toast.showToast('保存成功')
					RouteUtil.toHome()
				})
			}
		}
	}
</script>

<style lang="scss">
	.avatar{
		position: relative;
		top: -12rpx;
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;
		border: 2rpx solid #F5F5F5;
	}
</style>
